<?php

// A point in the game space. It defines the coordinates and a distance.
class stg_Point
{

	private $coordinates;

	public function stg_Point()
	{
		$this->coordinates = array(0,2);
	}

	public function get_coordinate($dim /* as Integer */)
	{
		return $this->coordinates[$dim];
	}
	
	public function distance($other /* as Point */)
	{
		$sum = 0;
		
		foreach ($this->coordinates as $coord) {
			$sum += $coord ^ 2;	
		}
		return sqrt($sum);
	}
	
	public function __toString() {
		//return "ola";
		return '('.implode(',', $this->coordinates).')';
	}
}
	
?>